package cn.stylefeng.guns.sys.modular.system.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.sys.modular.system.entity.ZxYusuanTemp;
import cn.stylefeng.guns.sys.modular.system.model.params.ZxYusuanTempParam;
import cn.stylefeng.guns.sys.modular.system.service.ZxYusuanTempService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 控制器
 *
 * @author jiangge
 * @Date 2020-12-07 14:07:01
 */
@Controller
@RequestMapping("/dgdzxYusuanTemp")
public class DgdZxYusuanTempController extends BaseController {

    private Long pinpai = 1417361607353536514L;

    private String PREFIX = "/modular/system/dgdzxYusuanTemp";

    @Autowired
    private ZxYusuanTempService zxYusuanTempService;

    /**
     * 跳转到主页面
     *
     * @author jiangge
     * @Date 2020-12-07
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/zxYusuanTemp.html";
    }

    /**
     * 新增页面
     *
     * @author jiangge
     * @Date 2020-12-07
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/zxYusuanTemp_add.html";
    }

    /**
     * 编辑页面
     *
     * @author jiangge
     * @Date 2020-12-07
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/zxYusuanTemp_edit.html";
    }

    /**
     * 新增接口
     *
     * @author jiangge
     * @Date 2020-12-07
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(ZxYusuanTempParam zxYusuanTempParam) {
        zxYusuanTempParam.setPinpai(pinpai);
        ResponseData data=this.zxYusuanTempService.add(zxYusuanTempParam);
        return data;
    }

    /**
     * 编辑接口
     *
     * @author jiangge
     * @Date 2020-12-07
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(ZxYusuanTempParam zxYusuanTempParam) {
        zxYusuanTempParam.setPinpai(pinpai);
        ResponseData data=this.zxYusuanTempService.update(zxYusuanTempParam);
        return data;
    }

    /**
     * 删除接口
     *
     * @author jiangge
     * @Date 2020-12-07
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(ZxYusuanTempParam zxYusuanTempParam) {
        ResponseData data=this.zxYusuanTempService.delete(zxYusuanTempParam);
        return data;
    }

    /**
     * 查看详情接口
     *
     * @author jiangge
     * @Date 2020-12-07
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(ZxYusuanTempParam zxYusuanTempParam) {
        ZxYusuanTemp detail = this.zxYusuanTempService.getById(zxYusuanTempParam.getXuhao());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author jiangge
     * @Date 2020-12-07
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(ZxYusuanTempParam zxYusuanTempParam) {
        zxYusuanTempParam.setPinpai(pinpai);
        return this.zxYusuanTempService.findPageBySpec(zxYusuanTempParam);
    }

}


